export function dateFormat(str) {
    if (!str) {
        return ""
    }
    var oDate = new Date(str),
        oYear = oDate.getFullYear(),
        oMonth = oDate.getMonth() + 1,
        oDay = oDate.getDate(),
        oHour = oDate.getHours(),
        oMin = oDate.getMinutes(),
        oSen = oDate.getSeconds(),
        oTime = oYear + '-' + getzf(oMonth) + '-' + getzf(oDay) + ' ' + getzf(oHour) + ':' + getzf(oMin) + ':' + getzf(oSen); //最后拼接时间  
    return oTime;
};
//补0操作  
function getzf(num) {
    if (parseInt(num) < 10) {
        num = '0' + num;
    }
    return num;
}


export function getNowFormatDate() {
    var char = "-";
    var nowDate = new Date();
    var day = nowDate.getDate();
    var month = nowDate.getMonth() + 1; //注意月份需要+1
    var year = nowDate.getFullYear();
    //补全0，并拼接
    var currentdate = year + char + (month < 10 ? "0" + month : month) + char + (day < 10 ? "0" + day : day);
    return currentdate;
}

export function formatDateFromDate(dateFormat) {
    var char = "-";
    // var nowDate = new Date();
    var nowDate = dateFormat;
    var day = nowDate.getDate();
    var month = nowDate.getMonth() + 1; //注意月份需要+1
    var year = nowDate.getFullYear();
    //补全0，并拼接
    var currentdate = year + char + (month < 10 ? "0" + month : month) + char + (day < 10 ? "0" + day : day);
    return currentdate;
}


export function getWeekToday() {
    var a = ["日", "一", "二", "三", "四", "五", "六"];
    var week = new Date().getDay();
    var str = "星期" + a[week];
    return str
}


export function isBlankApi(s) {

    if (!s || s.trim().length == 0) {
        return true
    }
    return false
}

export function logxApi(json) {
    console.log(JSON.stringify(json, undefined, 2));
}

function test1111() {
    // [{"value":"user","label":"用户"},{"value":"reviewer","label":"审核人"},{"value":"controller","label":"调度人"},{"value":"driver","label":"司机"}]
}